local skel = fk.CreateSkill {
  name = "emo__yazhi",
}

Fk:loadTranslationTable{
  ["emo__yazhi"] = "压制",
  [":emo__yazhi"] = "出牌阶段限一次，你可以将所有手牌当做无距离限制的【杀】使用，根据以此法使用牌获得效果：均为红色，改为火【杀】；至少2张，摸一张牌；至少3张，目标上限加一；至少4张，不可响应。",

  ["#emo__yazhi"] = "压制：将所有手牌当无距离限制的【%arg】使用%arg2",

  ["$emo__yazhi1"] = "发现目标，突击！",
  ["$emo__yazhi2"] = "是时候和你的好运说再见了。",
}

skel:addEffect("viewas", {
  anim_type = "offensive",
  mute_card = true,
  pattern = "slash",
  prompt = function (self, player, selected_cards, selected)
    local cards = player:getCardIds("h")
    local name = "slash"
    if table.every(cards, function (id) return Fk:getCardById(id).color == Card.Red end) then
      name = "fire__slash"
    end
    local prompt = "#emo__yazhi:::" .. name .. ":"
    if #cards > 1 then
      prompt = prompt .. "，摸一张牌"
      if #cards > 2 then
        prompt = prompt .. "，目标上限加一"
      end
      if #cards > 3 then
        prompt = prompt .. "，不可响应"
      end
    end
    return prompt
  end,
  card_filter = Util.FalseFunc,
  view_as = function (self, player)
    local cards = player:getCardIds("h")
    if #cards == 0 then return nil end
    local name = "slash"
    if table.every(cards, function (id) return Fk:getCardById(id).color == Card.Red end) then
      name = "fire__slash"
    end
    local c = Fk:cloneCard(name)
    c.skillName = skel.name
    c:addSubcards(cards)
    return c
  end,
  before_use = function(self, player, use)
    local room = player.room
    if #use.card.subcards >= 4 then
      use.disresponsiveList = table.simpleClone(room.alive_players)
    end
  end,
  after_use = function (self, player, use)
    if player.dead then return end
    if use and #use.card.subcards >= 2 then
      player:drawCards(1, skel.name)
    end
  end,
  times = function (self, player)
    return 1 - player:usedSkillTimes(skel.name, Player.HistoryPhase)
  end,
  enabled_at_play = function(self, player)
    return player:usedSkillTimes(skel.name, Player.HistoryPhase) == 0 and not player:isKongcheng()
  end,
  enabled_at_response = Util.FalseFunc,
})

skel:addEffect("targetmod", {
  bypass_distances = function(self, player, skill, card, to)
    return card and table.contains(card.skillNames, skel.name)
  end,
  extra_target_func = function(self, player, skill, card)
    if card and table.contains(card.skillNames, skel.name) and #card.subcards >= 3 then
      return 1
    end
  end,
})

return skel
